package com.yakumosakura.yakumoblade.specialeffects.theblades;

import com.yakumosakura.yakumoblade.utils.SlashBladeUtil;
import mods.flammpfeil.slashblade.capability.slashblade.ISlashBladeState;
import mods.flammpfeil.slashblade.event.SlashBladeEvent;
import mods.flammpfeil.slashblade.item.ItemSlashBlade;
import mods.flammpfeil.slashblade.registry.SpecialEffectsRegistry;
import mods.flammpfeil.slashblade.registry.specialeffects.SpecialEffect;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

import java.util.List;

@Mod.EventBusSubscriber
public class GhostBlade extends SpecialEffect {
    public GhostBlade() {
        super(20);
    }

    @SubscribeEvent
    public static void onKillCountAdd(SlashBladeEvent.AddKillCountEvent event) {
        ISlashBladeState state = SlashBladeUtil.getState(event.getBlade()).get();
        List<ResourceLocation> effects = state.getSpecialEffects();
        for (ResourceLocation effectId : effects) {
            SpecialEffect effect = SpecialEffectsRegistry.REGISTRY.get().getValue(effectId);
            if (effect instanceof GhostBlade Effect) {
                event.setNewCount(event.getOriginCount() * 2);
            }
        }
    }
    @SubscribeEvent
    public static void onProudCountAdd(SlashBladeEvent.AddProudSoulEvent event){
        ISlashBladeState state= SlashBladeUtil.getState(event.getBlade()).get();
        List<ResourceLocation> effects = state.getSpecialEffects();
        for (ResourceLocation effectId : effects) {
            SpecialEffect effect = SpecialEffectsRegistry.REGISTRY.get().getValue(effectId);
            if (effect instanceof GhostBlade Effect) {
                event.setNewCount(event.getOriginCount()*10);
            }
        }
    }





}
